<html>
<title></title>
<head>
<script language='JavaScript' type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script language='JavaScript' type="text/javascript" src="js/geometry.js"></script>
<script language='JavaScript' type="text/javascript" src="js/topology.js"></script>
<script language='JavaScript' type="text/javascript" src="js/drawing.js"></script>

<script language='JavaScript' type="text/javascript">
	function readdata()
{
query = "roadnet.txt";
	
	$.ajax({
		  type: 'POST',
		  url: query,
		  beforeSend:function(){
			  $('#info').html(''); 
		  },
		  success:function(data){
		  	dostaff(splitdata(data));
		  },
		  error:function(){}
		  });
}
function init()
{
	readdata();
}
function splitdata(data){
	var polygons = new Array();
	var mid = new Array();
	var finalresult = new Array();
	polygons = data.split("LINE:");
	
	for (var j = 1; j < polygons.length; j++) {
		mid = polygons[j].split(",");
		var t = 0;
		var result = new Array();
 		
		result = Simplify(CreatePolygon(mid), 50);
		
		finalresult[j-1] = {
			type: "polygon",
			geometry: result
		}
	}
	
	return finalresult;
}
function dostaff(geometry)
{

	var canvas = document.getElementById("canvas");
	Ccanvas = canvas;
	canvas.addEventListener('click', zoom, false);
	Cgeometry = geometry;
	var Boxobj = getBoundingBox(geometry);
	CzBox = Boxobj;
	var gitem = transform(geometry, Boxobj, canvas.width, canvas.height);
	drawing(gitem, false, "00f", canvas);
}
</script>

 </head>
 <body onload="init();">
   <canvas id="canvas" style="float: left; border:1px solid;" width="800" height="600" >
    yo! if you can see this msg then you utterly fail..change browser
   </canvas>
   <div id="info" style="float: left;"></div><br>
      <input type="button" "#" id= "btn1" onclick="canvasEvents('zoomin');" value="zoom in">
        <input type="button" "#" id= "btn1" onclick="canvasEvents('zoomout');" value="zoom out">
<br>
<div id="test"></div>
 </body>
</html>
